import React from 'react';
import { View, Text, Button, StyleSheet } from 'react-native';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { useNavigation } from '@react-navigation/native';
import { StackNavigationProp } from '@react-navigation/stack';

const Guide = () => {
    const navigation = useNavigation<StackNavigationProp<any>>();
    const handleCompleteGuide = async () => {
        // 在 AsyncStorage 中设置 guideFlag
        await AsyncStorage.setItem('guideFlag', 'true');
        // 导航到首页
        navigation.push('Home');
    };

    return (
        <View style={styles.container}>
            <Text style={styles.text}>Welcome to the Guide Page!</Text>
            <Button title="Complete Guide" onPress={handleCompleteGuide} />
        </View>
    );
};

const styles = StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: '#fff',
    },
    text: {
        fontSize: 24,
        marginBottom: 20,
    },
});

export default Guide;
